<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <title>仪表板 - 威客任务平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <meta http-equiv="refresh" content="0;url=/" />
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">威客任务平台</a>
            <div class="navbar-nav ms-auto">
                <span class="navbar-text me-3" sec:authentication="name"></span>
                <a class="nav-link" th:href="@{/profile}">个人资料</a>
                <form th:action="@{/logout}" method="post" class="d-inline-block">
                    <button type="submit" class="nav-link btn btn-link">退出</button>
                </form>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <h2>欢迎，<span th:text="${username}"></span>！</h2>
        
        <div sec:authorize="hasRole('ADMIN')">
            <div class="alert alert-info">
                <h4>管理员功能</h4>
                <a th:href="@{/admin/users}" class="btn btn-primary">用户管理</a>
                <a th:href="@{/admin/tasks}" class="btn btn-primary">任务管理</a>
            </div>
        </div>
        
        <div sec:authorize="hasRole('EMPLOYER')">
            <div class="alert alert-info">
                <h4>雇主功能</h4>
                <p>作为雇主，您可以发布任务、管理项目和评价威客。</p>
                <a th:href="@{/employer/tasks}" class="btn btn-primary">任务管理</a>
                <a th:href="@{/employer/task-applications}" class="btn btn-primary">查看所有承接项目</a>
                <a th:href="@{/employer/tasks/publish}" class="btn btn-success">发布新任务</a>
            </div>
        </div>
        
        <div sec:authorize="hasRole('FREELANCER')">
            <div class="alert alert-info">
                <h4>威客功能</h4>
                <p>作为威客，您可以浏览任务、申请任务和提交工作成果。</p>
                <a th:href="@{/freelancer/tasks}" class="btn btn-primary">浏览可申请任务</a>
                <a th:href="@{/freelancer/my-applications}" class="btn btn-primary">查看我的申请</a>
                <a th:href="@{/freelancer/task-applications}" class="btn btn-primary">任务管理</a>
            </div>
        </div>
        
        <p>如果您的浏览器没有自动跳转，请<a href="/">点击这里</a>进入主页。</p>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>